#! /bin/sh

if [ -f Makefile -a "x`grep -s NATIVE_MAKE Makefile`" != "x" ] ; then
	exit 0
fi

OS=`uname`

if [ "x${OS}" = "x" ] ; then
	echo "Cannot guess your make type."
	exit 1
fi

MY_MAKE="make"

case "x${OS}" in
	xLinux)
	;;
	xFreeBSD|xSunOS)
		MY_MAKE="gmake"
	;;
	*)
		echo "Your make type is a wild guess."
	;;
esac

if [ -f ./.my_make ] ; then
	eval `grep MAKE ./.my_make`
fi

if [ -z "${MAKE}" ] ; then
	echo "MAKE=${MY_MAKE}" >> .my_make
else
	if [ ${#} -lt 1 -o "x${1}" != "x-q" ] ; then
		echo "your make type already set:"
		cat .my_make
		exit 1
	fi
fi

exit 0

